package weak_20241227_29.stream;

import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zdl
 * @date 2024/12/27
 */
public class Demo16_false {
    public static void main(String[] args) {
        //16. 对字符串列表按单词长度进行分组，并打印出每个长度组的单词列表
        ArrayList<String> list = new ArrayList<>();
        list.add("asd");
        list.add("asdqwe");
        list.add("wer");
        list.add("asdpljk");
        list.add("asdikj");
        list.add("ouy");
        Map<Integer, Long> collect = list.stream().collect(Collectors.groupingBy(s -> s.length(), Collectors.counting()));
        System.out.println(collect);
    }
}
